package com.ypx.ec.search.web;

import com.ypx.ec.search.service.EsSearchService;
import com.ypx.ec.search.vo.SearchParamVo;
import com.ypx.ec.search.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.io.IOException;

@Controller
public class ListController {
    @Autowired
    EsSearchService esSearchService;
    @GetMapping({"/list.html","/search.html"})
    public String getListPage(SearchParamVo searchParamVo, Model model) throws IOException {
        SearchResult searchResult = esSearchService.productSearch(searchParamVo);
        model.addAttribute("result",searchResult);
        return "list";
    }
}
